//
//  WNLockMemberModel.swift
//  WNLockDemo
//
//  Created by 裴威 on 03/09/2018.
//  Copyright © 2018 wunu. All rights reserved.
//

import Foundation
import ObjectMapper

struct WNLockMemberListModel {
    var lockMembers: [WNLockAuthorizedMember]?
    var tempMembers: [WNLockTemporaryMember]?
    var isOwner: Bool?
}

extension WNLockMemberListModel: Mappable {
    init?(map: Map) {
    }
    mutating func mapping(map: Map) {
        lockMembers <- map["lockMembers"]
        tempMembers <- map["tempMembers"]
        isOwner <- map["isOwner"]
    }
}

struct WNLockAuthorizedMember {
    var `id`: Int?
    var name: String?
    var photo: String?
    var group: Int?
    var state: Int?
}
extension WNLockAuthorizedMember: Mappable {
    public init?(map: Map) {
        id <- map["id"]
        name <- map["name"]
        photo <- map["photo"]
        group <- map["group"]
        state <- map["state"]
    }
    mutating public func mapping(map: Map) {
        id <- map["id"]
        name <- map["name"]
        photo <- map["photo"]
        group <- map["group"]
        state <- map["state"]
    }
}

struct WNLockTemporaryMember {
    var `id`: Int?
    var name: String?
    var photo: String?
    var state: Int?
    var tempKey: Int?
    var startTime: String?
    var validTime: Int?
    var validCount: Int?
}

extension WNLockTemporaryMember: Mappable {
    public init?(map: Map) {
    }
    public mutating func mapping(map: Map) {
        id <- map["id"]
        name <- map["name"]
        photo <- map["photo"]
        state <- map["state"]
        tempKey <- map["tempKey"]
        startTime <- map["startTime"]
        validTime <- map["validTime"]
        validCount <- map["validCount"]
    }
}
